using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace OpenComposite.EII.XSDEditor
{
    public partial class formCtEdit : Form
    {
        public formCtEdit()
        {
            InitializeComponent();
        }
        public formCtEdit(string name, string minOccurs, string maxOccurs, bool hasMinMax)
        {
            InitializeComponent();
            tbName.Text = name;

            if (hasMinMax)
            {
                tbMinOccurs.Text = minOccurs;
                tbMaxOccurs.Text = maxOccurs;
            }
            else
            {
                tbMinOccurs.Enabled = false;
                tbMaxOccurs.Enabled = false;
            }
        }
        public string NewName
        {
            get { return tbName.Text; }
        }
        public string MinOccursString
        {
            get { return tbMinOccurs.Text; }
        }
        public string MaxOccursString
        {
            get { return tbMaxOccurs.Text; }
        }

        //internal string GetNewName()
        //{
        //    return tbName.Text;
        //}
        //internal string GetMinOccurs()
        //{
        //    return tbMinOccurs.Text;
        //}
        //internal string GetMaxOccurs()
        //{
        //    return tbMaxOccurs.Text;
        //}

        private void btnOK_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.OK;
            this.Close();
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.Cancel;
            this.Close();
        }

        private void formCtEdit_Load(object sender, EventArgs e)
        {
            tbName.SelectAll();
            tbName.Focus();
        }
    }
}